package edu.szu.huhanpeng.doodlingFight.controller.showController.appStart 
{
	import com.bit101.components.Panel;
	import edu.szu.huhanpeng.doodlingFight.globalConst.GlobalConst;
	import edu.szu.huhanpeng.doodlingFight.material.BackgroundPic;
	import edu.szu.huhanpeng.doodlingFight.view.StagePanelMed;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.Stage;
	import org.puremvc.as3.interfaces.ICommand;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.interfaces.INotifier;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	
	/**
	 * ...
	 * @author Huhanpeng
	 */
	public class RrInitStagePanelSc extends SimpleCommand implements ICommand, INotifier 
	{
		
		override public function execute(note:INotification):void 
		{
			var body: Stage = note.getBody() as Stage ;
			
			if (body == null) 
			{
				if (GlobalConst.setting.DEBUG) 
				{
					throw new Error("body类型出错");
				}
				return;
			}
			
			var stagePanel:Panel = new Panel( body );
			
			var sprite:Sprite = new BackgroundPic();
			sprite.y = ( GlobalConst.setting.STAGE_HEIGHT - sprite.height ) / 2;
			stagePanel.addChildAt( sprite, 2 );
			
			stagePanel.color = GlobalConst.setting.STAGE_COLOR;
			stagePanel.setSize( GlobalConst.setting.STAGE_WIDTH, GlobalConst.setting.STAGE_HEIGHT );
			facade.registerMediator( new StagePanelMed(stagePanel) );
		}
		
	}

}